package com.hx.company.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hx.company.UserInterface;
import com.hx.company.service.MerchantInterfaceImple;
import com.hx.company.vo.Food;
import com.hx.company.vo.Merchant;
import com.hx.company.vo.MerchantLogin;
import com.hx.company.vo.UserLogin;

@Controller
public class MerchantController {
	@Autowired(required=true)
	private MerchantInterfaceImple mif;
	
	
	
	
	@RequestMapping("/merLogin")
	@ResponseBody
	public String merLogin(MerchantLogin me,HttpServletRequest request){
		System.out.println("........"+me.getMphone()+me.getMpassword());
		Boolean i=mif.MerchantLogin(me);	
		System.out.println(i+"0-0-0-0-");
		if(i==true)
		return "true";
		else return "false";
	}
	
	@RequestMapping("/merRegist")
	@ResponseBody
	public String merRegist(Merchant me,MerchantLogin ml,HttpServletRequest request){
		System.out.println("........"+me.getMphone()+ml.getMpassword());
		
		return mif.MerchantRegister(me, ml)+"";
	}
	
	
	@RequestMapping("/getMid")
	@ResponseBody
	public String getMid(String phone){
		return mif.getMid(phone);
	}
	
	@RequestMapping("/getMerFood")
	@ResponseBody
	public List<Food> getMerFood(String mid){
		System.out.println(mid+"-++++++++++++++");
		
		return mif.getMerchantFood(mid);
	}
	
	
}
